package com.csx.springcloud.invoke.openfeign.consumer.base.client.fallback;

import com.csx.springcloud.invoke.openfeign.consumer.base.client.ProviderClient;
import org.springframework.stereotype.Component;

/**
 * <p> what does this class do ? </p>
 *  This class is the Fallback fro ProviderClient. This mean is execute when  remote process invoke failed
 *  注意:
 *      Fallback类必须要实现 @FeignClient 标记的接口才能生效
 *      Fallback类必须要是一个 Spring Bean 才行
 * <p> How does it work ?</p>
 * <p> Why does it do this ?</p>
 *
 * @author cuisongxu
 * @date 2023/8/5 周六 17:17
 */
@Component
public class ProviderFallback implements ProviderClient {

    @Override
    public String getUsername() {
        return "fallback";
    }

    @Override
    public String testTimeout() {
        return null;
    }

    @Override
    public String testException() {
        return null;
    }

    @Override
    public String testFallback() {
        return "fallback response";
    }
}
